using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Logic;
using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    public abstract class BaseNonLevelServiceTrigger : IReusableClass
    {
        protected TViewEntity _host;
        protected IReadOnlyList<int> _configParams;

        public uint MaxStore => 50;
        /// <summary>
        /// 通用字段，不要改为MainCityTriggerType这种枚举，因为这个类的设计不仅仅可以给MainCity用
        /// </summary>
        public int type { get; private set; }

        public void Init(int type, IReadOnlyList<int> configParams)
        {
            this.type = type;
            this._configParams = configParams;
            OnInit();
        }

        public void InitHost(TViewEntity host)
        {
            this._host = host;
        }

        protected virtual void OnInit()
        {

        }

        public abstract bool OnTrigger(object dynamicObjParam, TrigValueTypeParam dynamicValueTypePram);

        public void OnReset()
        {
            type = 0;
            _host = null;
            _configParams = null;
            OnPoolReset();
        }

        protected abstract void OnPoolReset();
    }
}
